package com.paomi.client.activity.payResult;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.hannesdorfmann.mosby3.mvp.MvpView;
import com.paomi.client.R;
import com.paomi.client.activity.main.MainActivity;
import com.paomi.client.activity.person.MyOrderActivity;
import com.paomi.client.base.BaseMvpActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class ResultPayActivity extends BaseMvpActivity<MvpView, ResultPayPresenter> {


    @BindView(R.id.result_tv)
    TextView resultTv;
    @BindView(R.id.back_btn_first)
    Button backBtnFirst;
    @BindView(R.id.back_btn_my)
    Button backBtnMy;
    @BindView(R.id.status_txt)
    TextView statusTxt;
    @BindView(R.id.status_get)
    TextView statusGet;
    private String orderStatus;//1是订单取消2,确认收货

    @NonNull
    @Override
    public ResultPayPresenter createPresenter() {
        return new ResultPayPresenter();
    }

    @Override
    protected String setTitle() {
        return getResources().getString(R.string.pay_result);
    }

    @Override
    protected void showBack(TextView button_goback) {
        button_goback.setVisibility(View.VISIBLE);
        button_goback.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
        button_goback.setTextColor(getResources().getColor(R.color.main_color));
        button_goback.setText(getResources().getString(R.string.back_normal) + "返回");
        button_goback.setTypeface(iconfont);
    }

    @NonNull
    @Override
    protected int getLayoutId() {
        return R.layout.activity_result_pay;
    }

    @Override
    protected void initEvent() {
        resultTv.setTypeface(iconfont);
        orderStatus=getIntent().getStringExtra("orderStatus");
        if(orderStatus!=null){
            if(orderStatus.equals("1")){//订单取消
                statusTxt.setText(getResources().getString(R.string.cancel_pay));
                statusGet.setText(getResources().getString(R.string.cancel_order_pay));
            }else if(orderStatus.equals("2")){//确认收货
                statusTxt.setText(getResources().getString(R.string.confirm_pay));
                statusGet.setText(getResources().getString(R.string.confirm_receive));
            }
        }
    }

    @OnClick({R.id.back_btn_first, R.id.back_btn_my})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.back_btn_first:
                Intent i = new Intent(ResultPayActivity.this, MainActivity.class);
                startActivity(i);
                break;
            case R.id.back_btn_my:
                Intent i1 = new Intent(ResultPayActivity.this, MyOrderActivity.class);
                startActivity(i1);
                this.finish();
                break;
        }
    }
}
